import request from '@/utils/request'

// 查询生成表数据
export function getCompanyStatistics(data = {}) {
    return request({
        url: '/file/search/company-statistics',
        method: 'post',
        data
    })
}

export function getExportData(data = {}) {
    return request({
        url: '/file/export/exportCompanyInfo',
        method: 'post',
        data
    })
}

export function getSyncCompanyInfo(data = {}) {
    return request({
        url: '/file/export/syncCompanyInfo',
        method: 'post',
        data
    })
}

export function downloadFile(data) {
    return request({
        url: `/file/export/downloadCompanyInfo/${data}`,
        method: 'get'
    })
}

export function getProvincStatistics(data = {}) {
    return request({
        url: '/file/search/province-statistics',
        method: 'post',
        data
    })
}

export function getBatchName(data = {}) {
    return request({
        url: '/file/search/batch-list',
        method: 'get'
    })
}

// 同步工商信息
export function getBatchUpdate(data = {}) {
    return request({
        url: '/file/search/batch-update',
        method: 'post',
        data
    })
}

// 批次操作：删除
export function getBatchDelete(data = {}) {
    return request({
        url: `/file/search/batch/delete`,
        method: 'post',
        data
    })
}

// 批次操作：黑名单
export function getBatchBlack(data = {}) {
    return request({
        url: '/file/search/batch-update-black',
        method: 'post',
        data
    })
}

// 数据查询：列表
export function postFileList(query = {}) {
    return request({
        url: '/file/search/company-list',
        method: 'post',
        data: query,
        params: {
            pageNum: query.pageNum,
            pageSize: query.pageSize
        }
    })
}

export function batchDeleteBySelect(query = {}) {
    return request({
        url: '/file/search/batchDeleteBySelect',
        method: 'post',
        data: query
    })
}

export function getTopIndustryPhy() {
    return request.get('/file/search/industryphy-name')
}

// 数据查询：删除
export function postFileListDelete(data = {}) {
    return request({
        url: '/file/search/batchDelete',
        method: 'post',
        data
    })
}

/**
 * @description: echarts 报表查询
 * cityChart/市、legalPersonChart/法人、yearChart/年限、phoneChart/风险、industryChart/行业、省/provinceChart
 */
export function getReport(query = {}, getUrl, value) {
    const arr = value === 'cityChart' ? `&province=${value}` : ''
    return request({
        url: `/file/chart/${getUrl}` + arr,
        method: 'get',
        params: query
    })
}

export function getReport1(data = {}) {
    return request({
        url: '/file/chart/batchDis',
        method: 'post',
        data
    })
}

export function postFileBatchClean(data = {}) {
    return request({
        url: '/file/search/batch/clean',
        method: 'post',
        data
    })
}

export function postFileBatchStopSyn(data = {}) {
    return request({
        url: '/file/search/batch/stop-syn',
        method: 'post',
        data
    })
}

//新增查询模版
export function postFileModelCreate(data = {}) {
    return request({
        url: '/file/search/model/add',
        method: 'post',
        data
    })
}

//删除查询模版
export function deleteFileModel(data = {}) {
    return request({
        url: `/file/search/model/del?id=${data.id}`,
        method: 'delete'
    })
}

//查询模版列表信息
export function getFileModelList(query = {}) {
    return request({
        url: '/file/search/model/list',
        method: 'get',
        params: query
    })
}

export function postFileBatchStopSynBlack(data = {}) {
    return request({
        url: '/file/search/batch/stop-syn-black',
        method: 'post',
        data
    })
}

export function removeFile(query) {
    return request({
        url: '/file/export/delete',
        method: 'get',
        params: query
    })
}

export function getJobStatus() {
    return request.get('/file/search/job-status')
}

export function getCapTypeList() {
    return request.get('/file/search/cap-type-name')
}
